# cd  /g/Desktop/demo/test/SafetyChecklist-App
# cd /home/kasia/project/SafetyChecklist-App
if [[ $3 == "aky" ]]; then
  cd /home/kasia/project/app-aky
else
  cd /home/kasia/project/check-list-enterprise
fi

# pwd
if [[ $1 == "正式环境" ]]; then
  git checkout master
  sleep 1
  git pull
elif [[ $1 == "测试环境" ]]; then
  git checkout test
  sleep 1
  git pull
fi

if [[ $1 != '' ]]; then
  if [[ $3 == 'enterprise' ]]; then
    text=$(cat enterprise/pubspec.yaml)
    sed -i "5c version: $2" enterprise/pubspec.yaml
  elif [[ $3 == 'goverment' ]]; then
    text=$(cat goverment/pubspec.yaml)
    sed -i "5c version: $2" goverment/pubspec.yaml
  elif [[ $3 == "aky" ]]; then
    text=$(cat enterprise/pubspec.yaml)
    sed -i "5c version: $2" enterprise/pubspec.yaml
  fi

  sleep 3
  git add .
  sleep 3
  git commit -m"release $2"
  sleep 3
  git push
  sleep 3
  # windows
  ## ./a.sh
  # linux
  bash a.sh $3
fi

echo '结束执行'
